/****************************************************************************/
/* File: scs-application.h                                                  */
/* Desc: Specification file for the core application type                   */
/* Created: 2014-11-11                                                      */
/* Revised: 2014-11-12                                                      */
/* Authors: Sterling P. de Mille                                            */
/****************************************************************************/

// include once
#ifndef _SCS_APPLICATION_H_
#define _SCS_APPLICATION_H_

// core data types
#include "scs-types.h"
// core error codes
#include "scs-error.h"
// core clock type
#include "scs-clock.h"
// video display type
#include "../Video/scs-display.h"

// SDL framework
#include <SDL/SDL.h>

// I/O support
#include <iostream>
// C string support
#include <string.h>
// assert support
#include <assert.h>

using namespace std;

// engine application type
class SCSapplication
{
protected:

	SCSstring m_sTitle;
	SCSstring m_sVersion;
	SCSbool m_iRunning;

	// application singleton
	static SCSapplication* m_pkSingleton;

	SCSdisplay m_kDisplay;
	SCSclock m_kClock;
//	SCSinput m_kInput;
//	SCSmixer m_kMixer;

	void InitOpenGL ();

public:

	// constructors
 	SCSapplication ();
 	// destructor
 	virtual ~SCSapplication ();

 	// create application
 	SCSerror Create (const SCSstring sTitle, const SCSstring sVersion, SCSint iSizeX, SCSint iSizeY, SCSbool iFullscreen = SCS_FALSE);
 	SCSerror Create (const SCSstring sTitle, const SCSstring sVersion, SCSbool iFullscreen = SCS_FALSE);

 	// run application
 	void Start ();
 	void Stop ();

 	virtual void Init () = 0;
 	virtual void Load () = 0;
 	virtual void Unload () = 0;

 	// application frame
 	void BeginFrame ();
 	void EndFrame ();
 	virtual void Frame () = 0;

 	// application info
 	SCSstring Title () const;
 	SCSbool Running () const;
 	SCSstring Version () const;

	void Fullscreen (SCSbool iEnable);
	void Cursor (SCSbool iEnable);

	// singleton access
	static SCSapplication* Singleton ();
};

#endif // _SCS_APPLICATION_H_
